<template>
  <div id="mymap" style="htight: 500px; width: 800px"></div>
</template>
<script>
import '@supermap/iclient-classic/libs/SuperMap.Include'
import '@supermap/iclient-classic/libs/SuperMap-8.1.1-17729'
import { SuperMap } from '@supermap/iclient-classic'
var map, layer
export default {
  name: 'supermap',
  data() {
    return {}
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      map = new SuperMap.Map('mymap', {
        controls: [
          new SuperMap.Control.Navigation(),
          new SuperMap.Control.Zoom()
        ]
      })
      map.addControl(new SuperMap.Control.MousePosition())
      // 初始化图层
      layer = new SuperMap.Layer.TiledDynamicRESTLayer('China', 'https://iserver.supermap.io/iserver/services/map-world/rest/maps/World', null, { maxResolution: 'auto' })
      // 监听图层信息加载完成事件
      layer.events.on({ layerInitialized: addLayer })

      function addLayer() {
        map.addLayer(layer)
        // 显示地图范围
        map.setCenter(new SuperMap.LonLat(0, 0), 1)
      }
      console.log(map)
    }

  }
}
</script>
<style lang="scss" scoped>

</style>
